import java.util.Scanner;

public class Utils {
    public static int getIntInput(Scanner scanner, String prompt) {
        while (true) {
            System.out.print(prompt);
            try {
                return Integer.parseInt(scanner.nextLine().trim());
            } catch (Exception e) {
                System.out.println("请输入有效的整数！");
            }
        }
    }
}
